/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package overlaynetwork;


import protocol.Packet;
/**
 *
 * @author fabrizioscenna
 */
public class PingController extends Thread{
    
    OverlayNetwork overlay;

    public PingController(OverlayNetwork overlay){
        this.overlay = overlay;
    }


  
     public void run(){
          //while(true){
            try{
                sleep(3000);
                Packet ping = overlay.getProtocol().ping();
                overlay.getCachePackets().put(ping.getGUID(), ping);
                overlay.connect().sendPacket(ping);


            }catch(Exception e){
               System.err.println("errore in send ping");
            }
        //}
      }



}